<template>
  <div class="container">
    <el-form :model="data.form" label-width="auto">
      <el-form-item label="网站名称">
        <el-input v-model="data.form.sitename" />
      </el-form-item>
      <el-form-item label="网站描述">
        <el-input v-model="data.form.description" />
      </el-form-item>
      <el-form-item label="链接文字">
        <el-input v-model="data.form.linkText" />
      </el-form-item>
      <el-form-item label="链接地址">
        <el-input v-model="data.form.linkUrl" />
      </el-form-item>
      <el-form-item label="联系地址">
        <el-input v-model="data.form.address" />
      </el-form-item>
      <el-form-item label="站长">
        <el-input v-model="data.form.owner" />
      </el-form-item>
      <el-form-item label="电话">
        <el-input v-model="data.form.mobile" />
      </el-form-item>
      <el-form-item label="微信">
        <el-input v-model="data.form.weixin" />
      </el-form-item>
      <el-form-item label="&nbsp;">
        <el-button type="primary" @click="onSubmit">保存</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import { ref, reactive, onMounted } from "vue";
import { getSettingInfo, updateSetting } from "@/api/index";
const data = reactive({});
data.form = {
  address: "",
  copyright: "",
  description: "",
  description: "",
  fax: "",
  keyword: "",
  linkText: "",
  linkUrl: "",
  mobile: "",
  owner: "",
  qq: "",
  sitename: "",
  tel: "",
  weixin: "",
};
const getInfo = () => {
  getSettingInfo().then((res) => {
    if (res.code == 200) {
      data.form = res.data;
    }
  });
};
const onSubmit = () => {
  updateSetting(data.form).then((res) => {
    if (res.code == 200) {
      ElMessage.success("设置修改成功！");
    }else{

    }
  });
};
onMounted(() => {
  getInfo();
});
</script>

<style lang="less" scoped>
.container {
}
</style>